﻿/// <reference path="application.js" />

function DrawDebugInfo() {
    // Draw 0 reference x & y lines
    window.app.context.container2d.fillStyle = "red";
    app.context.container2d.fillRect(0, app.UI.ToScreenY(0), app.context.container.width, 1);
    app.context.container2d.fillRect(app.UI.ToScreenX(0), 0, 1, app.context.container.height);

    // Draw grid and coordinates of each line element
    window.app.context.container2d.fillStyle = "rgba(100,0,0,0.3)";
    window.app.context.container2d.font = "9px arial";
    window.app.context.container2d.textAlign = "left";
    var gridLength = 100;
    for (var i = window.app.data.camera.y % gridLength,
        yLine = window.app.data.camera.y - i;
        i < app.context.container.height;
        i += gridLength, 
        yLine -= gridLength) {
            app.context.container2d.fillRect(0, i, app.context.container.width, 1);
            app.context.container2d.fillText(yLine.toString(), 4, i - 1);
    }
    for (i = -window.app.data.camera.x % gridLength,
        xLine = window.app.data.camera.x + i;
        i < app.context.container.width; 
        i += gridLength,
        xLine += gridLength) {
            app.context.container2d.fillRect(i, 0, 1, app.context.container.height);
            app.context.container2d.fillText(xLine.toString(), i + 1, 10);
    }
};